﻿using System.Windows;

namespace BusinessIntelligenceToolkit.Controls.ContainerGenerators
{
    public class BitListBoxContainerGenerator : BitItemsControlContainerGenerator
    {
        public BitListBoxContainerGenerator(BitListBox target)
            : base(target)
        {
        }

        public new BitListBox Target
        {
            get
            {
                return base.Target as BitListBox;
            }
        }

        public override UIElement PrepareContainerForItem(System.Windows.UIElement container, object data)
        {
            UIElement preparedContainer = base.PrepareContainerForItem(container, data);
            container.SetValue(BitListBox.IsSelectedItemProperty, Target.SelectedItems.Contains(data));
            return preparedContainer;
        }
    }
}